﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace WebApplication1.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    [Authorize] // 👈 整个控制器都需要授权才能访问

    public class HelloController : ControllerBase
    {
        /// <summary>
        /// 获取欢迎信息
        /// </summary>
        /// <returns>返回字符串消息</returns>
        [HttpGet]
        public string Get()
        {
            return "Hello from your .NET Web Server!";
        }
    }
}
